%% Plots for known-type model
model_pick = 'type';

V = eval(['V_',model_pick]);
Beta = eval(['Beta_',model_pick]);
C = eval(['C_',model_pick]);
K = eval(['K_',model_pick]);


%% Formatting parameters
paperposition = [0 0 8 4.5];
definition = '-r500';
axis_font = 6;
label_font = 10;
legend_font = 8;

edgecolor = 'k';

linewidth = 1;

color1 = 'b';
color2 = 'r';
color3 = [0.4940 0.1840 0.5560];

marker1 = 'o';
marker2 = '^';
marker3 = '*';

marker_size = 5.5;

marker_spacing = [1:20:n_grid];

%% INTERPOLANTS

V_FUN = griddedInterpolant(PHI,V);

C_FUN = griddedInterpolant(PHI,C);
K_FUN = griddedInterpolant(PHI,K);
Beta_FUN = griddedInterpolant(PHI,Beta);


%% V
VAR1 = V_FUN(PHI);
ymin = nanmin(VAR1);
ymax = nanmax(VAR1);
figure;
hold on
l1 = plot(PHI, VAR1, 'Color', color1, 'LineWidth', linewidth);
ylim([ymin ymax])
set(gca,'FontSize',axis_font);
Xla=xlabel('Known type ($$\pi$$)','Interpreter','Latex','FontSize',label_font);
set(Xla, 'Units', 'Normalized');
Yla=ylabel('Cost function ($$j^\pi$$)','Interpreter','Latex','FontSize',label_font);
set(Yla, 'Units', 'Normalized');
set(gcf,'PaperUnits','centimeters')
set(gcf, 'PaperPosition', paperposition);
print('-dpng',gcf,['V_',model_pick,'.png'],'-r500');
hold off; clear h; close;


%% Beta
VAR1 = Beta_FUN(PHI);
ymin = nanmin(VAR1);
ymax = nanmax(VAR1);
figure;
hold on
l1 = plot(PHI, VAR1, 'Color', color1, 'LineWidth', linewidth);
ylim([ymin ymax])
set(gca,'FontSize',axis_font);
Xla=xlabel('Known type ($$\pi$$)','Interpreter','Latex','FontSize',label_font);
set(Xla, 'Units', 'Normalized');
Yla=ylabel('Incentives ($$\hat \beta^\pi$$)','Interpreter','Latex','FontSize',label_font);
set(Yla, 'Units', 'Normalized');
set(gcf,'PaperUnits','centimeters')
set(gcf, 'PaperPosition', paperposition);
print('-dpng',gcf,['Beta_',model_pick,'.png'],'-r500');
hold off; clear h; close;


%% C

VAR1 = C_FUN(PHI);
ymin = nanmin(VAR1);
ymax = nanmax(VAR1);
figure;
hold on
l1 = plot(PHI, VAR1, 'Color', color1, 'LineWidth', linewidth);
ylim([ymin ymax])
set(gca,'FontSize',axis_font);
Xla=xlabel('Known type ($$\pi$$)','Interpreter','Latex','FontSize',label_font);
set(Xla, 'Units', 'Normalized');
Yla=ylabel('Compensation ratio ($$c^\pi$$)','Interpreter','Latex','FontSize',label_font);
set(Yla, 'Units', 'Normalized');
set(gcf,'PaperUnits','centimeters')
set(gcf, 'PaperPosition', paperposition);
print('-dpng',gcf,['C_',model_pick,'.png'],'-r500');
hold off; clear h; close;


%% K
VAR1 = K_FUN(PHI);
ymin = nanmin(VAR1);
ymax = nanmax(VAR1);
figure;
hold on
l1 = plot(PHI, VAR1, 'Color', color1, 'LineWidth', linewidth);
ylim([ymin ymax])
set(gca,'FontSize',axis_font);
Xla=xlabel('Known type ($$\pi$$)','Interpreter','Latex','FontSize',label_font);
set(Xla, 'Units', 'Normalized');
Yla=ylabel('Capital ratio ($$k^\pi$$)','Interpreter','Latex','FontSize',label_font);
set(Yla, 'Units', 'Normalized');
set(gcf,'PaperUnits','centimeters')
set(gcf, 'PaperPosition', paperposition);
print('-dpng',gcf,['K_',model_pick,'.png'],'-r500');
hold off; clear h; close;


%% epsilon_C
VAR1 = Beta_FUN(PHI)/sigma;
ymin = nanmin(VAR1);
ymax = nanmax(VAR1);
figure;
hold on
l1 = plot(PHI, VAR1, 'Color', color1, 'LineWidth', linewidth);
ylim([ymin ymax])
set(gca,'FontSize',axis_font);
Xla=xlabel('Known type ($$\pi$$)','Interpreter','Latex','FontSize',label_font);
set(Xla, 'Units', 'Normalized');
Yla=ylabel('Pay-perfor. sens. ($$\epsilon_C^\pi$$)','Interpreter','Latex','FontSize',label_font);
set(Yla, 'Units', 'Normalized');
set(gcf,'PaperUnits','centimeters')
set(gcf, 'PaperPosition', paperposition);
print('-dpng',gcf,['epsilon_C_',model_pick,'.png'],'-r500');
hold off; clear h; close;



